<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/9/21
 * Time: 20:49
 */

namespace Home\Controller;


use Think\Controller;

class MessageController extends Controller
{
    public function index(){
        $this->display('Index/message_board');
    }

    public function messCode(){
        $Verify =     new \Think\Verify();
        $Verify->fontSize = 30;
        $Verify->length   = 3;
        $Verify->useNoise = false;

        $Verify->entry();
    }
    function check_verify($code, $id = ''){
        $verify = new \Think\Verify();
        return $verify->check($code, $id);
    }


    public function addMessage(){
        $data['message'] = I('post.mess');
        if (!$data['message']){
            $this->ajaxReturn(0);
        }
        $data['user_id'] = isset($_SESSION['lblUser']) ? $_SESSION['lblUser'] : '';
        $data['createtime'] = date("Y-m-d H:i:s",time());
        $result = D('message')->add($data);
        if ($result){
            $this->ajaxReturn(1);
        }
        $this->ajaxReturn(0);
    }
}